package com.hennissy.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel("Json数据")
public class ResultAjax {

	/**
	 * 状态码
	 */
	@ApiModelProperty(value = "状态码")
	private int code;

	/**
	 * 提示信息
	 */
	@ApiModelProperty(value = "提示信息")
    private String msg;

	/**
	 * 数据
	 */
	@ApiModelProperty(value = "数据")
    private Object data;

	/**
	 * 数据总数
	 */
	@ApiModelProperty(value = "数据总数")
    private int count;

	private ResultAjax(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	private ResultAjax(int code, String msg, Object data) {
		this.code = code;
		this.msg = msg;
		this.data = data;
	}

	private ResultAjax(int code, String msg, Object data, int count) {
		this.code = code;
		this.msg = msg;
		this.data = data;
		this.count = count;
	}

	public static ResultAjax ok(int code, String msg){
		ResultAjax resultMap=new ResultAjax(code,msg);

		return resultMap;
	}

	public static ResultAjax ok(int code, String msg, Object data){
		ResultAjax resultMap=new ResultAjax(code,msg,data);

		return resultMap;
	}

	public static ResultAjax ok(int code, String msg, Object data, int count){
		ResultAjax resultMap=new ResultAjax(code,msg,data,count);

		return resultMap;
	}

	public static ResultAjax fail(int code, String msg){
		ResultAjax resultMap=new ResultAjax(code,msg);

		return resultMap;
	}

	public static ResultAjax fail(int code, String msg, Object data){
		ResultAjax resultMap=new ResultAjax(code,msg,data);

		return resultMap;
	}

	public static ResultAjax fail(int code, String msg, Object data, int count){
		ResultAjax resultMap=new ResultAjax(code,msg,data,count);

		return resultMap;
	}

}